import { connect } from "react-redux";

import { add, jian, change } from "./store/actions";

function App({ count, add, jian, change }) {
  return (
    <div>
      <h1>App</h1>
      <button onClick={add}>{count}</button>

      <button onClick={jian}>自减</button>
      <button onClick={() => change()}>设置100</button>
      <button onClick={() => change(200)}>设置200</button>
    </div>
  );
}

export default connect(
  (state) => ({
    count: state.count,
  }),
  {
    add,
    jian,
    change,
    // 函数返回一个动作即可
    // add: () => ({ type: INCREMENT }),
    // jian: () => ({ type: DECREMENT }),
  }
)(App);
